package com.zhangshitong.springbootModel.utils;


public class ClientContext implements Cloneable{

	 private String userName;
	  private String userID;
	  private String ip;
	  private String mac;
	  private String requestIP;
	  private String token;
	  private static final long serialVersionUID = 6207832949508781439L;
	  private int flag;
	  private int timeout = -1;

	  public Object clone() throws CloneNotSupportedException
	  {
	    super.clone();
	    ClientContext context = new ClientContext();

	    context.setIp(this.ip);
	    context.setMac(this.mac);
	    context.setUserName(this.userName);
	    context.setUserID(this.userID);
	    context.setToken(this.token);
	    return context;
	  }

	  public void setFlag(String flag) {
	    if (StringUtils.isNullOrEmpty(flag))
	      this.flag = 0;
	    this.flag = Integer.parseInt(flag);
	  }

	  public int getFlag() {
	    return this.flag;
	  }

	  public String getToken() {
	    return this.token;
	  }

	  public void setToken(String token) {
	    this.token = token;
	  }

	  public boolean isDebugingServer() {
	    return (this.flag & 0x1) != 0;
	  }

	  public void setDebugingSqlFlag(boolean p_flag) {
	    if (p_flag)
	      this.flag |= 1;
	    else if (isDebugingServer())
	      this.flag -= 1;
	  }

	  public String getIp() {
	    return this.ip;
	  }

	  public void setIp(String ip) {
	    this.ip = ip;
	  }

	  public String getMac() {
	    return this.mac;
	  }

	  public void setMac(String mac) {
	    this.mac = mac;
	  }

	  public String getUserName() {
	    return this.userName;
	  }

	  public void setUserName(String userName) {
	    this.userName = userName;
	  }

	  public String getRequestIP() {
	    return this.requestIP;
	  }

	  public void setRequestIP(String requestIP) {
	    this.requestIP = requestIP;
	  }

	  public void setFlag(int flag) {
	    this.flag = flag;
	  }

	  public int getTimeout() {
	    return this.timeout;
	  }

	  public void setTimeout(int timeout) {
	    this.timeout = timeout;
	  }

	  public String getUserID() {
	    return this.userID;
	  }

	  public void setUserID(String userID) {
	    this.userID = userID;
	  }
}
